package cc.atliberty.structural.adapter.ex3;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;

/**
 * @Author 元宵
 * @url www.atliberty.cc
 * @Date 2023-10-31 08:06
 * @description:
 */
public class Client1 {
    public static void main(String[] args) {
        ArrayList<String> arr = new ArrayList<>();
        arr.add("第一个元素");
        arr.add("第二个元素");
        arr.add("第三个元素");
        arr.add("第四个元素");
        arr.add("第五个元素");
        System.out.println("============iterator遍历===========");
        Iterator it = arr.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        System.out.println("============Enumeration遍历===========");
        Vector<String> vector = new Vector<>(arr);
        Enumeration<String> elements = vector.elements();
        while (elements.hasMoreElements()) {
            System.out.println(elements.nextElement());
        }
    }
}
